(function (u, q) {
    function x(a) {
        return function (c) {
            return Object.prototype.toString.call(c) === "[object " + a + "]"
        }
    }

    function Q(a) {
        a = a.replace(ja, "/");
        for (a = a.replace(ka, "$1/"); a.match(R);) a = a.replace(R, "/");
        return a
    }

    function S(a) {
        a = Q(a);
        la.test(a) ? a = a.slice(0, -1) : ma.test(a) || (a += ".js");
        return a.replace(":80/", "/")
    }

    function T(a, c) {
        return na.test(a) ? a : oa.test(a) ? (c || v).match(H)[0] + a : pa.test(a) ? (v.match(qa) || ["/"])[0] + a.substring(1) : j.base + a
    }

    function U(a, c) {
        if (!a) return "";
        var b = a, d = j.alias, b = a = d && I(d[b]) ? d[b] : b, d = j.paths, f;
        if (d && (f = b.match(ra)) && I(d[f[1]])) b = d[f[1]] + f[2];
        f = b;
        var J = j.vars;
        J && -1 < f.indexOf("{") && (f = f.replace(sa, function (a, b) {
            return I(J[b]) ? J[b] : a
        }));
        a = T(f, c);
        f = a = S(a);
        var b = j.map, e = f;
        if (b) for (d = 0; d < b.length && !(e = b[d], e = y(e) ? e(f) || f : f.replace(e[0], e[1]), e !== f); d++) ;
        return e
    }

    function V(a, c) {
        var b = a.sheet, d;
        if (W) b && (d = !0); else if (b) try {
            b.cssRules && (d = !0)
        } catch (f) {
            "NS_ERROR_DOM_SECURITY_ERR" === f.name && (d = !0)
        }
        setTimeout(function () {
            d ? c() : V(a, c)
        }, 20)
    }

    function ta() {
        if (z) return z;
        if (A && "interactive" === A.readyState) return A;
        for (var a = w.getElementsByTagName("script"), c = a.length - 1; 0 <= c; c--) {
            var b = a[c];
            if ("interactive" === b.readyState) return A = b
        }
    }

    function B(a) {
        this.uri = a;
        this.dependencies = [];
        this.exports = null;
        this.status = 0
    }

    function r(a, c) {
        if (C(a)) {
            for (var b = [], d = 0; d < a.length; d++) b[d] = r(a[d], c);
            return b
        }
        b = {id: a, refUri: c};
        s("resolve", b);
        return b.uri || U(b.id, c)
    }

    function D(a, c) {
        C(a) || (a = [a]);
        X(a, function () {
            for (var b = [], d = 0; d < a.length; d++) b[d] = Y(l[a[d]]);
            c && c.apply(u, b)
        })
    }

    function X(a, c) {
        var b = Z(a);
        if (0 === b.length) c(); else {
            s("load", b);
            for (var d = b.length, f = d, e = 0; e < d; e++) (function (a) {
                function b(c) {
                    c || (c = d);
                    var f = Z(e.dependencies);
                    0 === f.length ? c() : $(e) ? (f = n, f.push(f[0]), aa("Circular dependencies: " + f.join(" -> ")), n.length = 0, c(!0)) : (ba[a] = f, X(f, c))
                }

                function d(a) {
                    !a && e.status < K && (e.status = K);
                    0 === --f && c()
                }

                var e = l[a];
                e.dependencies.length ? b(function (b) {
                    function c() {
                        d(b)
                    }

                    e.status < E ? ca(a, c) : c()
                }) : e.status < E ? ca(a, b) : d()
            })(b[e])
        }
    }

    function ca(a, c) {
        function b() {
            delete L[f];
            M[f] = !0;
            F && (da(a, F), F = q);
            var b, c = G[f];
            for (delete G[f]; b = c.shift();) b()
        }

        l[a].status = ua;
        var d = {uri: a};
        s("fetch", d);
        var f = d.requestUri || a;
        if (M[f]) c(); else if (L[f]) G[f].push(c); else {
            L[f] = !0;
            G[f] = [c];
            var e = j.charset;
            s("request", d = {uri: a, requestUri: f, callback: b, charset: e});
            if (!d.requested) {
                var d = d.requestUri, h = va.test(d), g = p.createElement(h ? "link" : "script");
                if (e && (e = y(e) ? e(d) : e)) g.charset = e;
                var k = g;
                h && (W || !("onload" in k)) ? setTimeout(function () {
                    V(k, b)
                }, 1) : k.onload = k.onerror = k.onreadystatechange = function () {
                    wa.test(k.readyState) && (k.onload = k.onerror = k.onreadystatechange = null, !h && !j.debug && w.removeChild(k), k = q, b())
                };
                h ? (g.rel = "stylesheet", g.href = d) : (g.async = !0, g.src = d);
                z = g;
                ea ? w.insertBefore(g, ea) : w.appendChild(g);
                z = q
            }
        }
    }

    function xa(a, c, b) {
        1 === arguments.length && (b = a, a = q);
        if (!C(c) && y(b)) {
            var d = [];
            b.toString().replace(ya, "").replace(za, function (a, b, c) {
                c && d.push(c)
            });
            c = d
        }
        var f = {id: a, uri: r(a), deps: c, factory: b};
        if (!f.uri && p.attachEvent) {
            var e = ta();
            e ? f.uri = e.src : aa("Failed to derive: " + b)
        }
        s("define", f);
        f.uri ? da(f.uri, f) : F = f
    }

    function da(a, c) {
        var b = l[a] || (l[a] = new B(a));
        b.status < E && (b.id = c.id || a, b.dependencies = r(c.deps || [], a), b.factory = c.factory, b.factory !== q && (b.status = E))
    }

    function Y(a) {
        function c(b) {
            return r(b, a.uri)
        }

        function b(a) {
            return Y(l[c(a)])
        }

        if (!a) return null;
        if (a.status >= fa) return a.exports;
        a.status = fa;
        b.resolve = c;
        b.async = function (a, d) {
            D(c(a), d);
            return b
        };
        var d = a.factory, d = y(d) ? d(b, a.exports = {}, a) : d;
        a.exports = d === q ? a.exports : d;
        a.status = Aa;
        return a.exports
    }

    function Z(a) {
        for (var c = [], b = 0; b < a.length; b++) {
            var d = a[b];
            d && (l[d] || (l[d] = new B(d))).status < K && c.push(d)
        }
        return c
    }

    function $(a) {
        var c = ba[a.uri] || [];
        if (0 === c.length) return !1;
        n.push(a.uri);
        a:{
            for (a = 0; a < c.length; a++) for (var b = 0; b < n.length; b++) if (n[b] === c[a]) {
                a = !0;
                break a
            }
            a = !1
        }
        if (a) {
            a = n[0];
            for (b = c.length - 1; 0 <= b; b--) if (c[b] === a) {
                c.splice(b, 1);
                break
            }
            return !0
        }
        for (a = 0; a < c.length; a++) if ($(l[c[a]])) return !0;
        n.pop();
        return !1
    }

    function ga(a) {
        var c = j.preload, b = c.length;
        b ? D(r(c), function () {
            c.splice(0, b);
            ga(a)
        }) : a()
    }

    function N(a) {
        for (var c in a) {
            var b = a[c];
            if (b && "plugins" === c) {
                c = "preload";
                for (var d = [], f = void 0; f = b.shift();) d.push(ha + "plugin-" + f);
                b = d
            }
            if ((d = j[c]) && Ba(d)) for (var g in b) d[g] = b[g]; else C(d) ? b = d.concat(b) : "base" === c && (b = S(T(b + "/"))), j[c] = b
        }
        s("config", a);
        return e
    }

    var m = u.seajs;
    if (!m || !m.version) {
        var e = u.seajs = {version: "2.0.0pre"}, Ba = x("Object"), I = x("String"), C = Array.isArray || x("Array"),
            y = x("Function"), aa = e.log = function (a, c) {
                u.console && (c || j.debug) && console[c || (c = "log")] && void 0
            }, t = e.events = {};
        e.on = function (a, c) {
            if (!c) return e;
            (t[a] || (t[a] = [])).push(c);
            return e
        };
        e.off = function (a, c) {
            if (!a && !c) return e.events = t = {}, e;
            var b = t[a];
            if (b) if (c) for (var d = b.length - 1; 0 <= d; d--) b[d] === c && b.splice(d, 1); else delete t[a];
            return e
        };
        var s = e.emit = function (a, c) {
                var b = t[a], d;
                if (b) for (b = b.slice(); d = b.shift();) d(c);
                return e
            }, H = /[^?#]*\//, ja = /\/\.\//g, ka = /([^:\/])\/\/+/g, R = /\/[^/]+\/\.\.\//g, ma = /\?|\.(?:css|js)$|\/$/,
            la = /#$/, ra = /^([^/:]+)(\/.+)$/, sa = /{([^{]+)}/g, na = /(?:^|:)\/\/./, oa = /^\./, pa = /^\//,
            qa = /^.*?\/\/.*?\//, p = document, h = location, v = h.href.match(H)[0],
            g = p.getElementsByTagName("script"), g = p.getElementById("seajsnode") || g[g.length - 1],
            ha = (g.hasAttribute ? g.src : g.getAttribute("src", 4)).match(H)[0] || v;
        e.cwd = function (a) {
            return a ? v = Q(a + "/") : v
        };
        var w = p.getElementsByTagName("head")[0] || p.documentElement, ea = w.getElementsByTagName("base")[0],
            va = /\.css(?:\?|$)/i, wa = /^(?:loaded|complete|undefined)$/, z, A,
            W = 536 > 1 * navigator.userAgent.replace(/.*AppleWebKit\/(\d+)\..*/, "$1"),
            za = /"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|\/\*[\S\s]*?\*\/|\/(?:\\\/|[^/\r\n])+\/(?=[^\/])|\/\/.*|\.\s*require|(?:^|[^$])\brequire\s*\(\s*(["'])(.+?)\1\s*\)/g,
            ya = /\\\\/g, l = e.cache = {}, F, L = {}, M = {}, G = {}, ba = {}, ua = 1, E = 2, K = 3, fa = 4, Aa = 5;
        B.prototype.destroy = function () {
            delete l[this.uri];
            delete M[this.uri]
        };
        var n = [];
        e.use = function (a, c) {
            ga(function () {
                D(r(a), c)
            });
            return e
        };
        e.resolve = U;
        u.define = xa;
        B.load = D;
        var O = ha, ia = O.match(/^(.+?\/)(?:seajs\/)+(?:\d[^/]+\/)?$/);
        ia && (O = ia[1]);
        var j = N.data = {base: O, charset: "utf-8", preload: []};
        e.config = N;
        var P, h = h.search.replace(/(seajs-\w+)(&|$)/g, "$1=1$2"), h = h + (" " + p.cookie);
        h.replace(/seajs-(\w+)=1/g, function (a, c) {
            (P || (P = [])).push(c)
        });
        N({plugins: P});
        h = g.getAttribute("data-config");
        g = g.getAttribute("data-main");
        h && j.preload.push(h);
        g && e.use(g);
        if (m && m.args) {
            g = ["define", "config", "use"];
            m = m.args;
            for (h = 0; h < m.length; h += 2) e[g[m[h]]].apply(e, m[h + 1])
        }
    }
})(this);